﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ArgusControls
{
	public partial class ProgressBar : UserControl
	{
		public ProgressBar()
		{
			InitializeComponent();
		}

		public double Maximum { get { return this.cProgressBar.Maximum; } set { this.cProgressBar.Maximum = value; } }
		public double Minimum { get { return this.cProgressBar.Minimum; } set { this.cProgressBar.Minimum = value; } }

		public double Value
		{
			get { return this.cProgressBar.Value; }
			set
			{
				this.cProgressBar.Value = value;
				double d = value / (this.Maximum-this.Minimum);
				this.cTextBlock.Text = d.ToString("0%");
			}
		}

		public bool IsIndeterminate
		{
			get { return this.cProgressBar.IsIndeterminate; }
			set
			{
				if (value == this.IsIndeterminate)
					return;
				this.cProgressBar.IsIndeterminate = value;
				if (value == true)
					this.cTextBlock.Visibility = System.Windows.Visibility.Collapsed;
				else
					this.cTextBlock.Visibility = System.Windows.Visibility.Visible;
			}
		}
	}
}
